package com.wtgroup.demo.foo;//import sun.misc.*;

/**
需要使用 jdk9及以上版本编译, 否则, java: 程序包sun.misc不存在.
使用了, 运行此类报:
Exception in thread "main" java.lang.SecurityException: Unsafe
但其他类正常运行.
*/
public class HelloUnsafe {
    static class M {
        private M() {}

        int i =0;
    }

   public static void main(String[] args) throws InstantiationException {
        // Unsafe unsafe = Unsafe.getUnsafe();
        // M m = (M)unsafe.allocateInstance(M.class);
        // m.i = 9;
        // System.out.println(m.i);
    }
}
